from ronglian_sms_sdk import SmsSDK
import random
from myredis import r
def sms_code(mobile):
        accId = '1111'
        accToken = '222222222'
        appId = '33333333'
        sdk = SmsSDK(accId, accToken, appId)
        tid = '1'
        data=random.randint(100000,999999)
        datas = (data,7)
        r.set_str(mobile,data,60)
        resp = sdk.sendMessage(tid, mobile, datas)
        print(resp)
        return resp

def sms_code1(mobile):
        accId = '8a216da882f1f5940183546fe1c811a9'
        accToken = 'e13c2b7cd35645b78e4300577cedfbfc'
        appId = '8a216da882f1f5940183546fe2ce11b0'
        sdk = SmsSDK(accId, accToken, appId)
        tid = '1'
        data=f"尊敬的{mobile}用户，您在p2p平台的贷款即将到达还款日期，希望你注意还款日期，当老赖了弄死你哦"
        datas = (data,)
        print("datas>>>>>>>>",datas)
        resp = sdk.sendMessage(tid, mobile, datas)
        print(resp)
        return resp


